<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>微信秒杀管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			document.title="微信秒杀中奖者";
			$('#status').val('${seckillGainer.status}');
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/wechat/seckillGainer/">秒杀中奖者列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="seckillGainer" action="${ctx}/wechat/seckillGainer/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>姓名 ：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
		<label>手机 ：</label><form:input path="member.mobile" htmlEscape="false" maxlength="50" class="input-medium"/>
		
		 <label class="control-label" style="margin-top:3px;">开始时间:</label>
				
					<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
					<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${seckillGainer.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>  
<label class="control-label" style="margin-top:3px;">结束时间:</label>
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${seckillGainer.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
						<br><br>
						<label>状态：</label><select name="status" id="status"  class="input-medium">
												<option value="">全部</option>
												<option value="0">未使用</option>
												<option value="1">已使用</option>
												<option value="2">已作废</option>
											</select>
						<c:if test="${flag eq '0' }">
							<label>来源：</label>
							<form:select path="type" class="input-medium">
									<form:option value="0">商家</form:option>
									<form:option value="1">微购物</form:option>
							</form:select>
						</c:if>
		 
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<th>序号</th>
		<shiro:hasPermission name="sys:user:edit"><th>所属商家</th></shiro:hasPermission>
		<th>姓名</th>
		<th>手机</th><th>奖品</th><th>状态</th><th>有效时间</th><th>核销时间</th><shiro:hasPermission name="wechat:seckillGainer:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="seckillGainer" varStatus="s">
			<tr>
				<td>${s.index+1}</td>
				<shiro:hasPermission name="sys:user:edit"><td> ${seckillGainer.member.user.name} </td></shiro:hasPermission>
				<td title="${seckillGainer.qrCode.content }"> ${seckillGainer.userName} </td>
				<td>${seckillGainer.member.mobile}</td>
				<td>${seckillGainer.seckill.name}</td>
				<td><c:if test="${seckillGainer.status == 1 }">已使用</c:if> <c:if test="${seckillGainer.status == 0 }">未使用<c:if test="${seckillGainer.valid eq false }">-<b style="color:red">已过期</b></c:if></c:if><c:if test="${seckillGainer.status == 2 }">已作废</c:if></td>
				<td>${seckillGainer.createTime}<br>${seckillGainer.endTime}</td>
				<td title="${ seckillGainer.remarks}">${seckillGainer.updateTime}</td>
				
				
				<shiro:hasPermission name="wechat:seckillGainer:edit"><td>
				<c:if test="${seckillGainer.status eq '0' }">
    				<c:if test="${seckillGainer.valid eq true }"><a class="btn btn-primary" href="${ctx}/wechat/seckillGainer/update?id=${seckillGainer.id}&status=1">核销</a></c:if>
    				<a  class="btn btn-info" href="${ctx}/wechat/seckillGainer/update?id=${seckillGainer.id}&status=2">作废</a>
    				<a class="btn btn-warning" href="${ctx}/wechat/seckillGainer/form?id=${seckillGainer.id}">修改</a>
					<a class="btn btn-danger" href="${ctx}/wechat/seckillGainer/delete?id=${seckillGainer.id}" onclick="return confirmx('确认要删除该微信秒杀吗？', this.href)">删除</a>
    			</c:if>
    			
    			
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
